-
Notifications
You must be signed in to change notification settings - Fork 763
Delete threads with no replies #6578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements the deletion of threads that have no replies while reassigning threads that do have replies to the sumo bot. Key changes include:
- Updating tests in both forums and kbforums to verify that threads with no replies are deleted and threads with replies are reassigned.
- Modifying ThreadListener and PostListener in both forums and kbforums to reflect the new deletion and reassignment logic.
- Adjusting test data creation to include a replies count for threads.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
kitsune/forums/tests/test_handlers.py | Added tests for empty thread deletion and updated post creation in threads. |
kitsune/kbforums/tests/test_handlers.py | Updated thread creation to include replies count and added empty thread deletion tests. |
kitsune/kbforums/handlers.py | Changed ThreadListener to reassign threads with replies and delete others. |
kitsune/forums/handlers.py | Updated ThreadListener and PostListener to perform reassignment and thread deletion. |
Comments suppressed due to low confidence (1)
kitsune/forums/handlers.py:19
- Consider explicitly filtering for empty threads (e.g., using 'replies=0') when deleting threads. This change would improve code clarity and reduce any risk if the update to reassign threads does not take effect as expected.
threads_to_delete.delete()
Thread.objects.filter(creator=user).delete() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider explicitly filtering for threads with no replies (e.g., adding 'replies=0') during deletion to ensure that only threads with no replies are removed.
Thread.objects.filter(creator=user).delete() | |
Thread.objects.filter(creator=user, replies=0).delete() |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks @akatsoulas!
kitsune/forums/handlers.py
Outdated
threads_to_reassign.update(creator=Profile.get_sumo_bot()) | ||
threads_to_delete.delete() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nit. I think it would be easier to read/understand with the variables replaced with their actual queries like you do within the KB forums handler.
23688a1
to
ce74442
Compare
No description provided.